from goods.models import GoodsCategory


def get_breadcrumb(cat3):


    cat2=cat3.parent
    cat1=cat3.parent.parent
    breadcrumb = {
        'cat1': cat1,
        'cat2': cat2,
        'cat3': cat3
    }
    return breadcrumb

def hot_order(category_id):
    shop_data = GoodsCategory.objects.get(id=category_id)
    hot_data = shop_data.sku_set.filter(is_launched=True).order_by("-sales")[:2]
    hot_skus = []
    for i in hot_data:
        hot_skus.append({"id": i.id,
                         "default_image_url": i.default_image.url,
                         "name": i.name,
                         "price": i.price
                         })
    return hot_skus